📝 Add docstrings to issue-345-withany
#619
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive godoc comments to the new
WithAnyfunction and related code in PR #618, improving documentation for the flexible tool properties feature.Problem
PR #618 introduced the
WithAnyfunction for flexible tool properties but lacked comprehensive godoc documentation. The new function and updated example code needed proper documentation to help developers understand how to use the any-type property feature.Solution
Added detailed godoc comments following Go documentation conventions to:
WithAnyfunction inmcp/tools.goWithArrayfunction (expanded its existing docstring)Propertiesfunction (clarified its purpose)mainfunction inexamples/typed_tools/main.gotypedGreetingHandlerfunction (documenting the newAnyDatafield behavior)Changes Made
WithAnyfunction explaining its purpose, behavior, and how it handles the required flagWithArraygodoc to better describe its behavior with PropertyOption functions and the required field handlingPropertiesfunction godoc to explain it sets the "properties" map for object schemasmainfunction in typed_tools example, explaining the server setup and tool registrationtypedGreetingHandlerfunction, including error handling and the newAnyDataparameter formattingBreaking Changes
Testing
How to verify it
go test ./... -race- All tests passgolangci-lint run- 0 issues foundgo test -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v '/examples/' | grep -v '/testdata' | grep -v '/mcptest' | grep -v '/server/internal/gen')- Coverage maintained (67-80% across packages)Checklist
Additional Notes
This is a documentation-only PR generated by CodeRabbit AI bot in response to a request from @otaviof on PR #618. The changes improve code documentation without modifying any functionality. Since this only adds documentation comments and doesn't change user-facing behavior, no changelog entry is required.